<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:p="http://primefaces.org/ui"
	lang="en">
	
	<ui:decorate template="/WEB-INF/facelets/faceletListar.xhtml">
		<ui:define name="form">
				<h:messages id="messages" globalOnly="true"
                style="border: 1px solid #999999;background-color:#ffffee;padding:6px;font-weight:bold"
                errorStyle="color:#ff0000;font-weight:bold" layout="table"/>
                
				<h:form>
						<p:commandButton action="#{UsuarioMB.criar}" value="Novo &raquo;"></p:commandButton>
						<p></p>
						
						<p:dataTable 
							value="#{UsuarioMB.lista}" 
							var="obj" 
							selectionMode="single" 
							selection="#{UsuarioMB.entidade}"
							paginator="true"
							rows="10"
							rowKey="#{obj.id}"
							widgetVar="tabela">
							
							<p:ajax event="rowSelect" listener="#{UsuarioMB.selecionarEditar}"></p:ajax>
							<p:column sortBy="#{obj.nome}" filterBy="#{obj.nome}">
					        	<f:facet name="header">
					        		<h:outputText value="Nome" />
					        	</f:facet>
					            <h:outputText value="#{obj.nome}" />
					        </p:column>
					    </p:dataTable>
						
					</h:form>
				</ui:define>
	</ui:decorate>

</html>